<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

?>

<form action="index.php?option=com_letterman" method="post" name="adminForm" id="adminForm">

<table class="adminheading">
	<tr>
		<td width="100%">
			<label for="search"><?php echo JText::_( 'Filter' ) ?> : </label>
			<input type="text" name="search" id="search" value="<?php echo $this->search ?>" class="text_area" title="<?php echo JText::_( 'Filter by name or email' );?>"/>
			<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ) ?></button>
			<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
		</td>
	</tr>
</table>

<table class="adminlist">
	<thead>
		<tr>
			<th style="text-align:left">
			<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->rows ) ?>);" />
			</th>
			
			<th nowrap="nowrap"><?php echo JText::_('Subject') ?></th>
			
			<th nowrap="nowrap" width="100%"><?php echo JText::_('Message') ?></th>
			
			<th nowrap="nowrap"><?php echo JText::_('Created') ?></th>
			
			<th nowrap="nowrap"><?php echo JText::_('Last send') ?></th>
			
			<th nowrap="nowrap"><?php echo JText::_('Send now') ?></th>
			
			<th nowrap="nowrap"><?php echo JText::_('Published') ?></th>
			
		</tr>
	</thead>

	<tfoot>
		<tr>
			<td colspan="7">
				<del class="container">
					<div class="pagination">
						<div class="limit">
							<?php echo JText::_('Items per page')?> :&nbsp;&nbsp;
							<?php echo $this->pagination->getLimitBox() ?>&nbsp;&nbsp;
						</div>
						<?php echo $this->pagination->getPagesLinks() ?>
						<div class="limit"><?php echo $this->pagination->getPagesCounter() ?></div>
					</div>
				</del>
			</td>
		</tr>
	</tfoot>

	<tbody>

	<?php foreach ($this->rows as $k => $row) :?>

	<?php $altrow = empty($altrow)? 1 : 0 ?>

		<tr class="row<?php echo $altrow ?>">

			<td><?php echo JHTML::_('grid.checkedout', $row, $k ) ?></td>
			<td nowrap="nowrap">
			<?php if ($this->is_checkout($row->checked_out)) : ?>
			<?php echo $this->escape( $row->subject ) ?>
			<?php else : ?>
			<a href="#edit" onclick="return listItemTask('cb<?php echo $k ?>','edit')"><?php echo $this->escape( $row->subject ) ?>
			<?php endif ?>
			</a></td>
			<td><?php echo $this->renderGridMsg( $row->message, $row->html_message ) ?></td>
			<td nowrap="nowrap"><?php echo JHTML::_('date',  $row->created , JText::_('DATE_FORMAT_LC2') )?></td>
			<td nowrap="nowrap"><?php echo $this->renderLastSend( $row->send ) ?></td>
			<!-- sendNow -->
			<td align="center">
				<a class="modal" href="<?php echo $this->getViewUrl( 'task=send&id='.$row->id.'&tmpl=component' ) ?>" rel="{handler: 'iframe', size: {x: 400, y: 400}}" >
				<img src="../components/com_letterman/images/mail_send.png" alt="<?php echo JText::_('Send now')?>" border="0" />
				</a>
			</td>
			<td align="center"><?php echo JHTML::_('grid.published', $row, $k, 'publish_g.png') ?></td>
		</tr>

		<?php endforeach ?>

	</tbody>

</table>

<div>
	<input type="hidden" name="task" value="" /> 
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="limitstart" value="<?php echo $this->limitstart ?>" />
	<?php echo JHTML::_( 'form.token' ) ?>
</div>

</form>